<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
	</head>

<style>
	
	
	body{
	background-color: #FFFFFF;
	}
	a,.mui-title{
		color:#FFFFFF;
	}
	*{
		font-family:PingFang-SC-Medium;
	}
	.mui-bar{
		background: #FE635F;
	}
	
	.bianji{
		position: absolute;
		right: 10px;
		line-height: 44px;
		font-size:12px;
        font-weight:400;
        color:rgba(255,255,255,1);
	}
	.mui-content{
		position: relative;
		float: left;
		width:100%;
		height: 100%;
	   padding:10px  15px ;
	   background: #FFFFFF;
	   display: inline-block;
	}
	.ses{
		position: relative;
		float: left;
		width: 100%;
		height: 85px;
		margin-top: 20px;
	}
	.sex>div{
		width: 100%;
		height: 80px;
		padding: 10px  0px;
	}
	.title{
		width: 100%;
		height: 40px;
		font-size:15px;
        font-weight:400;
        color:#999999;
        line-height:40px;
	}
	
.qun{
	width: 100%;
	height: 40px;
	font-size:17px;
	font-weight:400;
    font-weight:500;
    color:rgba(51,51,51,1);
	line-height:40px;
	padding-left: 0px!important;
	border: none!important;
	border-bottom: 1px solid  rgba(236,236,236,1)!important;
}
</style>
	<body>
	  <header class="mui-bar mui-bar-nav">
	  	<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	  	<h1 class="mui-title">群聊名称</h1>
		<div  class="bianji">编辑</div>
	  </header>
	 <div class="mui-content">
		 
 <div class="mui-input-row mui-checkbox ses ">
	 <div>
		 <div  class="title">群聊名称</div>
		 <input id="qun"  class="qun" readonly  value="Beauty福利群"  type="text" /> 
	 </div>
</div>

	 </div>
	</body>
	
	<script src="../js/mui.js"></script>
	<script src="../js/jquery-3.1.1.min.js"></script>
		<script type="text/javascript">
		     	mui.init({
		     		beforeback: function() {　　　　
		     		var list = plus.webview.currentWebview().opener();　　　　
		     			  //refresh是A页面自定义事件
		     		mui.fire(list, 'refresh');
		     			 //返回true,继续页面关闭逻辑
		     		return true;
		     		},
		     	});
				mui.plusReady(function() {
					var url = plus.storage.getItem('url');
					var user = plus.storage.getItem('user');
					user = JSON.parse(user);
					var web = plus.webview.currentWebview();
					var qunid = web.qunid;
					var qunname = '';
					mui.post(url+'/juyou/Grouping/getquns',{token:user.token,qunid:qunid},function(res){
						if(res.code==200){
							$("#qun").val(res.data.qun.name)
							qunname = res.data.qun.name;
						}else{
							mui.toast(res.msg);
						}
					})
					
					
				var height = document.body.clientHeight;
				$(".mui-content").css("height", height)
				
				//是否删除操作
				$(document).on("click",".inbox",function(){
				var state=$(this).attr("state");
				if(state==0){
					$(this).attr("state","1")
					$(this).attr("src","../image/selectd.png")
				}else{
					$(this).attr("state","0")
					$(this).attr("src","../image/select.png")
				}
				})
				
				//点击编辑
					$(document).on("click",".bianji",function(){
						var value=$(this).text();
						if(value=="编辑"){
							$(this).text("完成")
							$(".ses .inbox").css("display","block")
							document.getElementById("qun").readOnly=false;
							
						}else{
							// 这里执行更改名字的操作
							var name = $("#qun").val();
							if(name==qunname){
								mui.toast('请先修改群名称!!');
								$(this).text("编辑")
								$(".ses .inbox").css("display","none")
								document.getElementById("qun").readOnly=true;
								return;
							}
							plus.nativeUI.showWaiting();
							mui.post(url+'/juyou/Grouping/changequnname',{token:user.token,qunid:qunid,name:name},function(res){
								plus.nativeUI.closeWaiting();
								if(res.code==200){
									mui.toast(res.msg);
									setTimeout(function(){
										$(this).text("编辑")
										$(".ses .inbox").css("display","none")
										document.getElementById("qun").readOnly=true;
										mui.back();
									},1500)
								}else{
									mui.toast(res.msg);
									setTimeout(function(){
										location.reload();
									},1500)
								}
							})
						
							
						}
					})
			})
			
		
			
			
			
	</script>

</html>
